<template>
  <div>
    <el-card shadow="never" class="mb20">
      <cycle-form @search="handleSearch" ref="cycleForm" />
    </el-card>
    <el-card shadow="never">
      <el-tooltip class="item" effect="dark" content="新增考评周期" placement="top">
        <el-button
          size="small"
          class="fr mb20"
          @click="handleEdit(false, {})"
          icon="el-icon-plus"
          type="primary"
        />
      </el-tooltip>
      <cycle-table @edit="handleEdit" ref="cycleTable" />
    </el-card>
    <cycle-modal @refresh="handleRefresh" ref="cycleModal" />
  </div>
</template>

<script>
import CycleForm from './CycleForm'
import CycleTable from './CycleTable'
import CycleModal from './CycleModal'

export default {
  components: {
    CycleForm,
    CycleTable,
    CycleModal
  },
  methods: {
    handleSearch(param) {
      this.$refs.cycleTable.handleGetList(param)
    },
    handleRefresh() {
      this.$refs.cycleTable.handleGetList()
    },
    handleEdit(bool, obj) {
      this.$refs.cycleModal.edit(bool, obj)
    }
  }
}
</script>
